<template>
  <div>
    <!-- <el-breadcrumb separator="/">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item>个人中心</el-breadcrumb-item>
      <el-breadcrumb-item>个人信息</el-breadcrumb-item>
    </el-breadcrumb> -->
    <br />
    <br />
    <div class="xin-xi">
      <div class="tou-xiang">
        <p style="font-size: 15px; color: #666; margin-left: 7px">头像：&nbsp;&nbsp;</p>
        <img  style="width: 120px;object-fit: cover;" height="120px" :src="info.img" alt="图片迷路了哟" />
      </div>
      <br />
      <ul class="list" :data="info">
        <li>用户名：<span>{{ info.shoujihao }}</span></li>
        <li>性&nbsp;&nbsp;&nbsp;别：<span>{{ info.xingbie }}</span></li>
        <li>生&nbsp;&nbsp;&nbsp;日：<span>{{ info.shengri }}</span></li>
        <li>邮&nbsp;&nbsp;&nbsp;箱：<span>{{ info.youxiang }}</span></li>
      </ul>
      <el-button style="width: 150px;" type="primary" @click="unLogin"
                >退出登录</el-button>
    </div>
  </div>
</template>

<script>
import httpApi from "@/myaxios/index";

export default {
  data() {
    return {
      // 用户信息
      info: [],
    };
  },
  methods: {
    // 退出登录
    unLogin(){
      window.localStorage.clear()
      this.$router.push('/')
    },
    // 请求用户信息
    searchYongHu() {
      // 获取当前登录用户信息 id
      let id = localStorage.getItem("id");
      // id查询当前用户信息
      httpApi.GuanLiApi.queryYongHu({ id }).then((res) => {
        console.log(res);
        this.info = res.data[0];
        console.log(this.info);
      });
    },
  },
 mounted() {
    // 挂载用户信息
    this.searchYongHu();
  },
};
</script>

<style lang="scss" scoped>
.xin-xi {
  display: flex;
  flex-direction: column;
  margin-top: 50px;
  margin-left: 100px;
  padding-left: 150px;
  padding-top: 30px;
  background-color: rgb(239, 242, 245);
  width: 800px;
}

.xin-xi > .list {
  list-style: none;
  height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}
.xin-xi > .list > li {
  font-size: 15px;
  color: #666;
}
.xin-xi > .list > li > span {
  margin-left: 30px;
  background-color: rgb(240, 232, 232);
}
// 头像框
.tou-xiang {
  display: flex;
  align-items: center;
}
</style>
